package com.sky.mapper;

import com.sky.annotations.AutoFill;
import com.sky.entity.DishEntity;
import com.sky.enumeration.DishStatusEnum;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {
    @Select("select count(id) from dish where category_id = #{id}")
    Integer countByCategoryId(Long id);

    @AutoFill(OperationType.INSERT)
    void save(DishEntity entity);

    List<DishVO> select(@Param("status") DishStatusEnum statusEnum,@Param("categoryId") Integer categoryId,@Param("name") String name);

    DishEntity getById(Integer id);

    @AutoFill(OperationType.UPDATE)
    void update(DishEntity entity);

    List<DishEntity> selectIds(List<Long> ids);

    void delBatch(List<Long> ids);
}
